<HTML><HEAD><TITLE>event_after(+Event, +Time, -DueTime)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Event Handling</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>event_after(+Event, +Time, -DueTime)</H1>
Set up an event Event which is triggered at DueTime, after Time seconds have elapsed
<DL>
<DT><EM>Event</EM></DT>
<DD>Atom or Handle
</DD>
<DT><EM>Time</EM></DT>
<DD>Positive number
</DD>
<DT><EM>DueTime</EM></DT>
<DD>Variable, will be bound to a float
</DD>
</DL>
<H2>Description</H2>
   The event Event is raised after Time seconds of elapsed time from when
   the predicate is executed.  This is identical to event_after/2, except
   that DueTime gets bound to the time at which the event will be raised.
   This time can be compared to the the current event_time as returned by
   statistics/2.
<P>
   For more details, see event_after/2.

<H3>Modes and Determinism</H3><UL>
<LI>event_after(+, +, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>Event is neither an atom nor a handle or Time is not a positive number.
</DL>
<H2>Examples</H2>
<PRE>
    % With the following the handler definition
    report_due(DueTime) :-
	 Remaining is DueTime - statistics(event_time),
	 printf("Event is due in %w seconds%n", [Remaining]).

    ?- event_create(abort, [], E1),
	event_after(E1, 5, Due),
	event_create(report_due(Due), [], E2),
	event_after_every(E2, 1),
	repeat, fail.
    Event is due in 3.98999999999999 seconds
    Event is due in 2.98 seconds
    Event is due in 1.97 seconds
    Event is due in 0.959999999999994 seconds
    Aborting execution ...
    Abort
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/event/event_after-2.html">event_after / 2</A>, <A HREF="../../kernel/event/event_after_every-2.html">event_after_every / 2</A>, <A HREF="../../kernel/event/cancel_after_event-2.html">cancel_after_event / 2</A>, <A HREF="../../kernel/event/events_after-1.html">events_after / 1</A>, <A HREF="../../kernel/event/event-1.html">event / 1</A>, <A HREF="../../kernel/event/set_event_handler-2.html">set_event_handler / 2</A>, <A HREF="../../kernel/event/current_after_events-1.html">current_after_events / 1</A>, <A HREF="../../kernel/event/event_create-3.html">event_create / 3</A>, <A HREF="../../kernel/event/event_retrieve-3.html">event_retrieve / 3</A>, <A HREF="../../kernel/env/get_flag-2.html">get_flag / 2</A>, <A HREF="../../kernel/env/statistics-2.html">statistics / 2</A>
</BODY></HTML>
